/*
 * @Author: yansheng 610363806@qq.com
 * @Date: 2024-06-28 21:14:20
 * @LastEditors: zhang00001 774004514@qq.com
 * @LastEditTime: 2024-07-24 09:53:47
 * @FilePath: \cell-admin\src\router\group\user.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Layout from '@/layout/index.vue'
import { getPower } from '@/utils/power'
const BASE_URL = '/user'
import { message } from 'ant-design-vue'
export default [{
    path: BASE_URL,
    component: Layout,
    name: 'User',
    meta: {
        title: '用户',
        isGroup: true,
        icon: 'i-carbon-user-multiple'
    },
    redirect: `${BASE_URL}/list`,
    children: [{
            path: `${BASE_URL}/list`,
            name: 'User_List',
            component: () =>
                import ('@/pages/user/list/index.vue'),
            meta: {
                title: '用户列表',
                icon: 'i-carbon-user-profile',

            },


        },
        {
            path: `${BASE_URL}/admin`,
            name: 'admin_List',
            component: () =>
                import ('@/pages/user/adminList.vue'),
            meta: {
                title: '管理员列表',
                icon: 'i-carbon-user-profile',
                hideInMenu: !getPower(32)
            },
            beforeEnter(to, from, next) {

                if (getPower(32)) {
                    next();
                } else {
                    message.error("暂无权限")
                    next('/exception/401-page');

                }

            },

        },
        // {
        //     path: `${BASE_URL}/role`,
        //     name: 'User_Role',
        //     component: () =>
        //         import ('@/pages/user/role/index.vue'),
        //     meta: {
        //         title: '角色列表',
        //         icon: 'i-carbon-user-role'
        //     }
        // },
        {
            path: `${BASE_URL}/record`,
            name: 'record',
            component: () =>
                import ('@/pages/user/record/index.vue'),
            meta: {
                title: '用户积分',
                hideInMenu: true
            }
        },
    ]
}]